<template>
  <div class="xiaobanxin diantai">
    <div class="diantai_top">
      <ul>
        <li v-for="(item, index) in daintaifenlei" :key="index">
          <img :src="item.pic96x96Url" alt="" />

          <p>{{ item.name }}</p>
        </li>
      </ul>
    </div>
    <div class="diantai_bou">
      <div class="tuijian">
        <div class="da_l">
          <div class="da_l_t">
            <h3>推荐节目</h3>
            <span>更多>></span>
          </div>
          <ul>
            <li v-for="(item, index) in tuijianjiemu" :key="index">
              <img :src="item.program.coverUrl" alt="" />
              <div class="jieshao">
                <p>{{ item.program.name }}</p>
                <p>{{ item.program.radio.name }}</p>
              </div>
              <div class="zhuanqu">{{ item.program.radio.category }}</div>
            </li>
          </ul>
        </div>
        <div class="da_r">
          <div class="da_l_t">
            <h3>节目排行榜</h3>
            <span>更多>></span>
          </div>
          <ul>
            <li v-for="(item, index) in jiemu" :key="index">
              <img :src="item.program.radio.picUrl" alt="" />
              <div class="jieshao">
                <p>{{ item.program.name }}</p>
                <p>{{ item.program.radio.name }}</p>
              </div>
            </li>
          </ul>
        </div>
      </div>
      <br />
      <div class="tuijianyinyue">
        <div class="yinyuetuijian">
          <span> <a href="#">音乐推荐</a>·电台</span>
          <span>更多>></span>
        </div>
        <div>
          <ul>
            <li v-for="(item, index) in tuijianyinyue" :key="index">
              <div>
                <img :src="item.intervenePicUrl" alt="" />
              </div>
              <div>
                <p>{{ item.name }}</p>
                <p>{{ item.rcmdtext }}</p>
              </div>
            </li>
          </ul>
        </div>
      </div>
      <br />
      <br />
      <br />
      <div class="tuijianyinyue">
        <div class="yinyuetuijian">
          <span> <a href="#">生活推荐</a>·电台</span>
          <span>更多>></span>
        </div>
        <div>
          <ul>
            <li v-for="(item, index) in tuijiansehnghuo" :key="index">
              <div>
                <img :src="item.intervenePicUrl" alt="" />
              </div>
              <div>
                <p>{{ item.name }}</p>
                <p>{{ item.rcmdtext }}</p>
              </div>
            </li>
          </ul>
        </div>
      </div>
      <br />
      <br />
      <br />
      <div class="tuijianyinyue">
        <div class="yinyuetuijian">
          <span> <a href="#">情感推荐</a>·电台</span>
          <span>更多>></span>
        </div>
        <div>
          <ul>
            <li v-for="(item, index) in tuijianqingan" :key="index">
              <div>
                <img :src="item.intervenePicUrl" alt="" />
              </div>
              <div>
                <p>{{ item.name }}</p>
                <p>{{ item.rcmdtext }}</p>
              </div>
            </li>
          </ul>
        </div>
      </div>
      <br />
      <br />
      <br />
      <div class="tuijianyinyue">
        <div class="yinyuetuijian">
          <span> <a href="#">翻唱推荐</a>·电台</span>
          <span>更多>></span>
        </div>
        <div>
          <ul>
            <li v-for="(item, index) in tuijianfancahng" :key="index">
              <div>
                <img :src="item.intervenePicUrl" alt="" />
              </div>
              <div>
                <p>{{ item.name }}</p>
                <p>{{ item.rcmdtext }}</p>
              </div>
            </li>
          </ul>
        </div>
      </div>
      <br />
      <br />
      <br />
      <div class="tuijianyinyue">
        <div class="yinyuetuijian">
          <span> <a href="#">知识推荐</a>·电台</span>
          <span>更多>></span>
        </div>
        <div>
          <ul>
            <li v-for="(item, index) in tuijianzhishi" :key="index">
              <div>
                <img :src="item.intervenePicUrl" alt="" />
              </div>
              <div>
                <p class="dianji">{{ item.name }}</p>
                <p>{{ item.rcmdtext }}</p>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {
  GetdiantaijiemuApi,
  GetdiantaijiemutuijianApi,
  daintaifenleiApi,
  GetdaintaifenleiApi,
  GetshdaintaifenleiApi,
  GetgqdaintaifenleiApi,
  GetfcdaintaifenleiApi,
  GetzsdaintaifenleiApi,
} from "../../request/api";
export default {
  data() {
    return {
      //节目
      jiemu: [],
      //推荐节目
      tuijianjiemu: [],
      //封类
      daintaifenlei: [],
      //音乐推荐
      tuijianyinyue: [],
      //生活推荐
      tuijiansehnghuo: [],
      //情感推荐
      tuijianqingan: [],
      //翻唱推荐
      tuijianfancahng: [],
      //知识推荐
      tuijianzhishi: [],
    };
  },
  created() {
    GetdiantaijiemuApi({ limit: 10 }).then((res) => {
      this.jiemu = res.data.toplist;
      console.log(this.jiemu);
    });
    GetdiantaijiemutuijianApi({ limit: 10 }).then((res) => {
      this.tuijianjiemu = res.data.data.list;
      console.log(this.tuijianjiemu);
    });
    daintaifenleiApi().then((res) => {
      this.daintaifenlei = res.data.categories;
      console.log(this.daintaifenlei);
    });
    GetdaintaifenleiApi({ type: "2" }).then((res) => {
      this.tuijianyinyue = res.data.djRadios;
      this.tuijianyinyue = this.tuijianyinyue.slice(0, 4);
      console.log(this.tuijianyinyue);
    });
    GetshdaintaifenleiApi({ type: "6" }).then((res) => {
      this.tuijiansehnghuo = res.data.djRadios;
      this.tuijiansehnghuo = this.tuijiansehnghuo.slice(0, 4);
      console.log(this.tuijiansehnghuo);
    });
    GetgqdaintaifenleiApi({ type: "3" }).then((res) => {
      this.tuijianqingan = res.data.djRadios;
      this.tuijianqingan = this.tuijianqingan.slice(0, 4);
      console.log(this.tuijianqingan);
    });
    GetfcdaintaifenleiApi({ type: "2001" }).then((res) => {
      this.tuijianfancahng = res.data.djRadios;
      this.tuijianfancahng = this.tuijianfancahng.slice(0, 4);
      console.log(this.tuijianfancahng);
    });
    GetzsdaintaifenleiApi({ type: "11" }).then((res) => {
      this.tuijianzhishi = res.data.djRadios;
      this.tuijianzhishi = this.tuijianzhishi.slice(0, 4);
      console.log(this.tuijianzhishi);
    });
  },
};
</script>
 
<style lang = "less" scoped>
@import url("../../assets/base.less");
.diantai {
  .diantai_top {
    height: 200px;
    background-color: #ccc;
    padding-bottom: 10px;
    box-sizing: border-box;
    overflow: hidden;
    ul {
      display: flex;
      justify-content: space-around;
      flex-wrap: wrap;
      li {
        width: 56px;
        height: 80px;
        margin: 10px 25px;
        cursor: pointer;
        img {
          box-sizing: border-box;
          width: 50px;
          margin: 5px 10px;
        }
        p {
          width: 80px;
          text-align: center;
        }
      }
    }
  }
  .diantai_bou {
    background-color: antiquewhite;
    .tuijian {
      display: flex;
      justify-content: space-around;
      .da_l {
        width: 400px;
        background-color: aqua;
        .da_l_t {
          height: 40px;
          display: flex;
          justify-content: space-between;
          align-items: center;
          h3:hover,
          span:hover {
            text-decoration: underline;
          }
        }
      }
      ul {
        border-top: 1px solid red;
        li {
          font-size: 12px;
          display: flex;
          margin: 10px;
          &:nth-child(even) {
            background-color: rgb(237, 230, 230);
          }
          img {
            width: 40px;
            height: 40px;
          }
          .jieshao {
            width: 100px;
            margin-left: 60px;
            p {
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              margin-bottom: 10px;
            }
            span {
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
          }
          .zhuanqu {
            border: 1px solid #ccc;
            margin: auto;
            padding: 5px;
          }
        }
      }
      .da_r {
        width: 400px;
        background-color: aquamarine;
      }
    }
  }
}

.tuijianyinyue {
  margin-left: 46px;
  width: 888px;
  p:nth-child(1) {
    font-weight: bolder;
    &:hover {
      text-decoration: underline;
    }
  }
  .yinyuetuijian {
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    span {
      font-size: 22px;
      a {
        text-decoration: none;
        color: black;

        &:hover {
          text-decoration: underline;
        }
      }
      &:nth-of-type(2) {
        &:hover {
          text-decoration: underline;
        }
      }
    }
  }
  ul {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    li {
      box-sizing: border-box;
      padding: 5px 0;
      width: 50%;
      border-bottom: 1px solid #ccc;
      display: flex;
      img {
        width: 130px;
      }
      p {
        margin: 30px;
      }
    }
  }
}
</style>